package com.hgl.exception;

/**
 * 
 * @author:HGL
 * ClassName:com.hgl.exception.CodeException.java
 * Date:2020年8月4日下午4:32:18
 * Version:1.0
 */
public class CodeException extends RuntimeException {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6204373962956843029L;
	private int code;
	private String message;
	
	
	
	
	/**
	 * 
	 */
	public CodeException(int code) {
		super();
		this.code = code;
	}
	/**
	 * @param message
	 * @param cause
	 * @param enableSuppression
	 * @param writableStackTrace
	 */
	public CodeException(int code,String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
		super(message, cause, enableSuppression, writableStackTrace);
		this.code = code;
		this.message = message;
	}
	/**
	 * @param message
	 * @param cause
	 */
	public CodeException(int code,String message, Throwable cause) {
		super(message, cause);
		this.code = code;
		this.message = message;
	}
	/**
	 * @param message
	 */
	public CodeException(int code,String message) {
		super(message);
		this.code = code;
		this.message = message;
	}
	/**
	 * @param cause
	 */
	public CodeException(int code,Throwable cause) {
		super(cause);
		this.code = code;
	}
	
	
	
	public String getMessage() {
		return message==null?("code."+code):message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public int getCode() {
		return code;
	}
	
	
	
}
